import {
  ChangeDetectionStrategy,
  type ChangeDetectorRef,
  Component,
  ViewEncapsulation,
} from "@angular/core";
import { Effect } from "effect";

@Component({
  selector: "pull-refresh-effect",
  templateUrl: "./pull-refresh.component.html",
  standalone: false,
  encapsulation: ViewEncapsulation.ShadowDom,
  changeDetection: ChangeDetectionStrategy.OnPush,
  exportAs: "pullRefreshEffect",
})
export class PullRefreshEffectComponent {
  fee = Effect.succeed(100);

  numberOfTicks = 0;

  constructor(private ref: ChangeDetectorRef) {
    setInterval(() => {
      this.numberOfTicks++;
      // require view to be updated
      this.ref.markForCheck();
    }, 1000);
  }
}
